package com.motu.monstercity.server.game.logic;

import com.motu.monstercity.server.game.userdata.*;
import com.motu.vertx.module.utility.model.EntityManager;
import com.motu.vertx.module.utility.model.Model;

import java.util.ArrayList;
import java.util.List;

public class RestaurantUserData extends RestaurantBaseData {
    public static UserRestaurantInfo getUserRestaurantInfo(long userId) {
        return (UserRestaurantInfo) EntityManager.getUniqueEntity(UserRestaurantInfo.class, userId);
    }

    public static UserRestaurantFood getUserRestaurantFood(long userId, int foodId) {
        return (UserRestaurantFood) EntityManager.getEntity(UserRestaurantFood.class, userId, foodId);
    }

    public static List<UserRestaurantFood> getUserRestaurantFoodList(long userId) {
        List<UserRestaurantFood> list = new ArrayList<>();
        for (Model model : EntityManager.getEntityList(UserRestaurantFood.class, userId)) {
            UserRestaurantFood entity = (UserRestaurantFood) model;
            list.add(entity);
        }
        return list;
    }

    public static UserRestaurantRoom getUserRestaurantRoom(long userId, int restaurantId) {
        return (UserRestaurantRoom) EntityManager.getEntity(UserRestaurantRoom.class, userId, restaurantId);
    }

    public static List<UserRestaurantRoom> getUserRestaurantRoomList(long userId) {
        List<UserRestaurantRoom> list = new ArrayList<>();
        for (Model model : EntityManager.getEntityList(UserRestaurantRoom.class, userId)) {
            UserRestaurantRoom entity = (UserRestaurantRoom) model;
            list.add(entity);
        }
        return list;
    }
}
